﻿<%@ Page Language="C#"  EnableEventValidation = "false" AutoEventWireup="true" CodeBehind="task.aspx.cs" Inherits="StreetSmartAdmin.task" %>
<%@ Register TagPrefix="CustUserCtrl" TagName="Header" Src="Header.ascx" %>
<%@ Register TagPrefix="CustUserCtrl" TagName="Footer" Src="Footer.ascx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<script language="javascript" type="text/javascript" src="WdatePicker.js"></script>
<head runat="server">
    <title></title>
    <link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
    <form id="form1" runat="server" enctype="multipart/form-data">
    <div>
     <CustUserCtrl:Header ID="Header" runat="server"></CustUserCtrl:Header>


         <center>
        <h1>IT Todo List</h1>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:SQLServer2005DBConnectionString %>" 
            DeleteCommand="DELETE FROM [tblTask] WHERE [TASKID] = @TASKID" 
            InsertCommand="INSERT INTO [tblTask] ([RELATEDID], [SUBJECT], [DETAILS], [PRIORITY], [COMPLETE], [STATUS], [TASKMANAGER], [ASSIGNTO], [ESTIDURATION], [STARTDATE], [FINISHDATE], [COMMENT], [ACTION]) VALUES (@RELATEDID, @SUBJECT, @DETAILS, @PRIORITY, @COMPLETE, @STATUS, @TASKMANAGER, @ASSIGNTO, @ESTIDURATION, @STARTDATE, @FINISHDATE, @COMMENT, @ACTION)" 
            SelectCommand="SELECT * FROM [tblTask] WHERE (([ASSIGNTO] like @ASSIGNTO) and ([STATUS] like @STATUS)) ORDER BY [TASKID] DESC" 
            
                 UpdateCommand="UPDATE [tblTask] SET [RELATEDID] = @RELATEDID, [SUBJECT] = @SUBJECT, [DETAILS] = @DETAILS, [PRIORITY] = @PRIORITY, [COMPLETE] = @COMPLETE, [STATUS] = @STATUS, [TASKMANAGER] = @TASKMANAGER, [ASSIGNTO] = @ASSIGNTO, [ESTIDURATION] = @ESTIDURATION, [STARTDATE] = @STARTDATE, [FINISHDATE] = @FINISHDATE, [COMMENT] = @COMMENT, [ACTION] = @ACTION WHERE [TASKID] = @TASKID">
            <DeleteParameters>
                <asp:Parameter Name="TASKID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="RELATEDID" Type="String" />
                <asp:Parameter Name="SUBJECT" Type="String" />
                <asp:Parameter Name="DETAILS" Type="String" />
                <asp:Parameter Name="PRIORITY" Type="String" />
                <asp:Parameter Name="COMPLETE" Type="String" />
                <asp:Parameter Name="STATUS" Type="String" />
                <asp:Parameter Name="TASKMANAGER" Type="String" />
                <asp:Parameter Name="ASSIGNTO" Type="String" />
                <asp:Parameter Name="ESTIDURATION" Type="String" />
                <asp:Parameter Name="STARTDATE" Type="String" />
                <asp:Parameter Name="FINISHDATE" Type="String" />
                <asp:Parameter Name="COMMENT" Type="String" />
                <asp:Parameter Name="ACTION" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="ddlsearch_ass" Name="ASSIGNTO" 
                    PropertyName="SelectedValue" Type="String" />
                    <asp:ControlParameter ControlID="ddlsearch_stu" Name="STATUS" 
                    PropertyName="SelectedValue" Type="String" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="RELATEDID" Type="String" />
                <asp:Parameter Name="SUBJECT" Type="String" />
                <asp:Parameter Name="DETAILS" Type="String" />
                <asp:Parameter Name="PRIORITY" Type="String" />
                <asp:Parameter Name="COMPLETE" Type="String" />
                <asp:Parameter Name="STATUS" Type="String" />
                <asp:Parameter Name="TASKMANAGER" Type="String" />
                <asp:Parameter Name="ASSIGNTO" Type="String" />
                <asp:Parameter Name="ESTIDURATION" Type="String" />
                <asp:Parameter Name="STARTDATE" Type="String" />
                <asp:Parameter Name="FINISHDATE" Type="String" />
                <asp:Parameter Name="COMMENT" Type="String" />
                <asp:Parameter Name="ACTION" Type="String" />
                <asp:Parameter Name="TASKID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>

        <asp:Panel ID="panSearch" runat="server" DefaultButton="btnsearch" Width="100%" >


                <asp:DropDownList ID="ddlsearch_stu" runat="server">
                    <asp:ListItem Value="%">Status:All</asp:ListItem>
                    <asp:ListItem>Not Started</asp:ListItem>
                    <asp:ListItem>Start On Track</asp:ListItem>
                    <asp:ListItem>Start Behind Schedule</asp:ListItem>
                    <asp:ListItem>Finish</asp:ListItem>
                    
                </asp:DropDownList>
                
                <asp:DropDownList ID="ddlsearch_ass" runat="server">
                    <asp:ListItem Value="%">Assign To:All</asp:ListItem>
                    <asp:ListItem>Gabriel Clouston</asp:ListItem>
                    <asp:ListItem>Liang Zhao</asp:ListItem>
                    <asp:ListItem>Roy Yang</asp:ListItem>
                    <asp:ListItem>Liang&Roy</asp:ListItem>
                    
                </asp:DropDownList>


                <asp:Button ID="btnsearch" runat="server" Text="Search" />
                
                
        </asp:Panel> 

        <br/>
        <asp:Button ID="Button1" runat="server" Text="Add New Record" OnClick="btnAddRecord_click"/>
        <asp:Label ID="PageSize" runat="server" Text="Page size: "></asp:Label>
        <asp:DropDownList ID="ddlpage" runat="server" AutoPostBack="True">
            <asp:ListItem Selected="True">10</asp:ListItem>
            <asp:ListItem>20</asp:ListItem>
            <asp:ListItem>50</asp:ListItem>
            <asp:ListItem>100</asp:ListItem>
        </asp:DropDownList>
        <asp:Button ID="export" runat="server" Text="Export" OnClick="export_Click"/>




       <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="TASKID" 
            DataSourceID="SqlDataSource1" EnableModelValidation="True" CellPadding="4" 
                 
                 ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                            CommandName="Select" Text="Select" ForeColor="Red"></asp:LinkButton>
                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"  ForeColor="Red"
                            CommandName="Delete" Text="Delete"  OnClientClick="return confirm('Are You Sure to Delete?')"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="TASKID" InsertVisible="False" 
                    SortExpression="TASKID">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("TASKID") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("TASKID") %>'></asp:Label>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="RELATEDID" HeaderText="RELATEDID" 
                    SortExpression="RELATEDID"  Visible="false"/>
                <asp:BoundField DataField="SUBJECT" HeaderText="SUBJECT" 
                    SortExpression="SUBJECT" />
                <asp:BoundField DataField="DETAILS" HeaderText="DETAILS" 
                    SortExpression="DETAILS" />
                <asp:BoundField DataField="PRIORITY" HeaderText="PRIORITY" 
                    SortExpression="PRIORITY" />
                <asp:BoundField DataField="COMPLETE" HeaderText="COMPLETE%" 
                    SortExpression="COMPLETE" />
                <asp:BoundField DataField="STATUS" HeaderText="STATUS" 
                    SortExpression="STATUS" />
                <asp:BoundField DataField="TASKMANAGER" HeaderText="ASSIGN FROM" 
                    SortExpression="TASKMANAGER" />
                <asp:BoundField DataField="ASSIGNTO" HeaderText="ASSIGN TO" 
                    SortExpression="ASSIGNTO" />
                <asp:BoundField DataField="ESTIDURATION" HeaderText="EST DURATION" 
                    SortExpression="ESTIDURATION" />
                <asp:BoundField DataField="STARTDATE" HeaderText="ACT START DATE" 
                    SortExpression="STARTDATE"  Visible="false" />
                <asp:BoundField DataField="FINISHDATE" HeaderText="ACT FINISH DATE" 
                    SortExpression="FINISHDATE"   Visible="false"/>
                <asp:BoundField DataField="COMMENT" HeaderText="COMMENT" 
                    SortExpression="COMMENT"  Visible="false"/>
                <asp:BoundField DataField="ACTION" HeaderText="ACTION" 
                    SortExpression="ACTION"  Visible="false"/>
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        </asp:GridView>
        <br />
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:SQLServer2005DBConnectionString %>" 
            DeleteCommand="DELETE FROM [tblTask] WHERE [TASKID] = @TASKID" 
            InsertCommand="INSERT INTO [tblTask] ([RELATEDID], [SUBJECT], [DETAILS], [PRIORITY], [COMPLETE], [STATUS], [TASKMANAGER], [ASSIGNTO], [ESTIDURATION], [STARTDATE], [FINISHDATE], [COMMENT], [ACTION]) VALUES (@RELATEDID, @SUBJECT, @DETAILS, @PRIORITY, @COMPLETE, @STATUS, @TASKMANAGER, @ASSIGNTO, @ESTIDURATION, @STARTDATE, @FINISHDATE, @COMMENT, @ACTION)" 
            SelectCommand="SELECT * FROM [tblTask] WHERE ([TASKID] = @TASKID)" 
            UpdateCommand="UPDATE [tblTask] SET [RELATEDID] = @RELATEDID, [SUBJECT] = @SUBJECT, [DETAILS] = @DETAILS, [PRIORITY] = @PRIORITY, [COMPLETE] = @COMPLETE, [STATUS] = @STATUS, [TASKMANAGER] = @TASKMANAGER, [ASSIGNTO] = @ASSIGNTO, [ESTIDURATION] = @ESTIDURATION, [STARTDATE] = @STARTDATE, [FINISHDATE] = @FINISHDATE, [COMMENT] = @COMMENT, [ACTION] = @ACTION WHERE [TASKID] = @TASKID">
            <DeleteParameters>
                <asp:Parameter Name="TASKID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="RELATEDID" Type="String" />
                <asp:Parameter Name="SUBJECT" Type="String" />
                <asp:Parameter Name="DETAILS" Type="String" />
                <asp:Parameter Name="PRIORITY" Type="String" />
                <asp:Parameter Name="COMPLETE" Type="String" />
                <asp:Parameter Name="STATUS" Type="String" />
                <asp:Parameter Name="TASKMANAGER" Type="String" />
                <asp:Parameter Name="ASSIGNTO" Type="String" />
                <asp:Parameter Name="ESTIDURATION" Type="String" />
                <asp:Parameter Name="STARTDATE" Type="String" />
                <asp:Parameter Name="FINISHDATE" Type="String" />
                <asp:Parameter Name="COMMENT" Type="String" />
                <asp:Parameter Name="ACTION" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="GridView1" Name="TASKID" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="RELATEDID" Type="String" />
                <asp:Parameter Name="SUBJECT" Type="String" />
                <asp:Parameter Name="DETAILS" Type="String" />
                <asp:Parameter Name="PRIORITY" Type="String" />
                <asp:Parameter Name="COMPLETE" Type="String" />
                <asp:Parameter Name="STATUS" Type="String" />
                <asp:Parameter Name="TASKMANAGER" Type="String" />
                <asp:Parameter Name="ASSIGNTO" Type="String" />
                <asp:Parameter Name="ESTIDURATION" Type="String" />
                <asp:Parameter Name="STARTDATE" Type="String" />
                <asp:Parameter Name="FINISHDATE" Type="String" />
                <asp:Parameter Name="COMMENT" Type="String" />
                <asp:Parameter Name="ACTION" Type="String" />
                <asp:Parameter Name="TASKID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
            DataKeyNames="TASKID" DataSourceID="SqlDataSource2"  DefaultMode="Edit"
            EnableModelValidation="True" Height="50px" Width="125px" CellPadding="4" 
            CommandRowStyle-Font-Size="13"   CommandRowStyle-ForeColor="red" 
                 OnItemInserted="DetailsView1_ItemInserted"
                 OnItemUpdated="DetailsView1_ItemUpdated"
            ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" />
            <CommandRowStyle Font-Size="13pt" BackColor="#D1DDF1" Font-Bold="True" />
            <EditRowStyle BackColor="#2461BF" />
            <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
            <Fields>
<asp:TemplateField HeaderText="TASKID" SortExpression="TASKID" InsertVisible="False">
<ItemTemplate>
                        <asp:Label ID="TASKID" runat="server" Text='<%# Bind("TASKID") %>'></asp:Label>
                    
</ItemTemplate>
    <EditItemTemplate>
        <asp:Label ID="TASKID" runat="server" Text='<%# Eval("TASKID") %>'></asp:Label>
    </EditItemTemplate>
</asp:TemplateField>

                <asp:TemplateField HeaderText="SUBJECT" SortExpression="SUBJECT">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("SUBJECT") %>'  Width="250px"></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("SUBJECT") %>'  Width="250px"></asp:TextBox>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="DETAILS" SortExpression="DETAILS">
                    <EditItemTemplate>

                        <asp:TextBox ID="Comments" Rows="8" cols="30" Width="97%" runat="server" TextMode="MultiLine"
                            Text='<%# Bind("DETAILS") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="Comments" Rows="8" cols="30" Width="97%" runat="server" TextMode="MultiLine"
                            Text='<%# Bind("DETAILS") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("SUBJECT") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Related To" SortExpression="RELATEDID">
                    <EditItemTemplate>
                        <asp:DropDownList ID="RELATEDID" runat="server" SelectedValue='<%# Bind("RELATEDID") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>Database</asp:ListItem>
                            <asp:ListItem>Website</asp:ListItem>
                            <asp:ListItem>IT hardware</asp:ListItem>
                            <asp:ListItem>Phones</asp:ListItem>
                            <asp:ListItem>Software issues</asp:ListItem>
                            <asp:ListItem>Others</asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="RELATEDID" runat="server" SelectedValue='<%# Bind("RELATEDID") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>Database</asp:ListItem>
                            <asp:ListItem>Website</asp:ListItem>
                            <asp:ListItem>IT hardware</asp:ListItem>
                            <asp:ListItem>Phones</asp:ListItem>
                            <asp:ListItem>Software issues</asp:ListItem>
                            <asp:ListItem>Others</asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("DETAILS") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="PRIORITY" SortExpression="PRIORITY">
                    <EditItemTemplate>
                        <asp:DropDownList ID="PRIORITY" runat="server" SelectedValue='<%# Bind("PRIORITY") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>Low</asp:ListItem>
                            <asp:ListItem>Medium</asp:ListItem>
                            <asp:ListItem>High</asp:ListItem>
                            <asp:ListItem>Extreme</asp:ListItem>
                        </asp:DropDownList>


                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="PRIORITY" runat="server" SelectedValue='<%# Bind("PRIORITY") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>Low</asp:ListItem>
                            <asp:ListItem>Medium</asp:ListItem>
                            <asp:ListItem>High</asp:ListItem>
                            <asp:ListItem>Extreme</asp:ListItem>
                                        
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("RELATEDID") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="COMPLETE" SortExpression="COMPLETE">
                    <EditItemTemplate>
                        <asp:DropDownList ID="COMPLETE" runat="server" SelectedValue='<%# Bind("COMPLETE") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>25%</asp:ListItem>
                            <asp:ListItem>50%</asp:ListItem>
                            <asp:ListItem>75%</asp:ListItem>
                            <asp:ListItem>100%</asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="COMPLETE" runat="server" SelectedValue='<%# Bind("COMPLETE") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>25%</asp:ListItem>
                            <asp:ListItem>50%</asp:ListItem>
                            <asp:ListItem>75%</asp:ListItem>
                            <asp:ListItem>100%</asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("PRIORITY") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="STATUS" SortExpression="STATUS">
                    <EditItemTemplate>
                        <asp:DropDownList ID="STATUS" runat="server" SelectedValue='<%# Bind("STATUS") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>Not Started</asp:ListItem>
                            <asp:ListItem>Start On Track</asp:ListItem>
                            <asp:ListItem>Start Behind Schedule</asp:ListItem>
                            <asp:ListItem>Finish</asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="STATUS" runat="server" SelectedValue='<%# Bind("STATUS") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>Not Started</asp:ListItem>
                            <asp:ListItem>Start On Track</asp:ListItem>
                            <asp:ListItem>Start Behind Schedule</asp:ListItem>
                            <asp:ListItem>Finish</asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label5" runat="server" Text='<%# Bind("COMPLETE") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ASSIGN FROM" SortExpression="TASKMANAGER">
                    <EditItemTemplate>
                        <asp:DropDownList ID="TASKMANAGER" runat="server" SelectedValue='<%# Bind("TASKMANAGER") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>Andrew Caragher</asp:ListItem>
                            <asp:ListItem>David Roberts</asp:ListItem>
                            <asp:ListItem>Gabriel Clouston</asp:ListItem>
                            <asp:ListItem>Grant Mayhew</asp:ListItem>
                            <asp:ListItem>James Rose</asp:ListItem>
                            <asp:ListItem>Kelvin Wiggins</asp:ListItem>
                            <asp:ListItem>Nicolas Gutierrez</asp:ListItem>
                            <asp:ListItem>Omar Sabbagh</asp:ListItem>
                            <asp:ListItem>Roy Yang</asp:ListItem>
                            <asp:ListItem>Samantha Davies</asp:ListItem>
                            <asp:ListItem>Liang Zhao</asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="TASKMANAGER" runat="server" SelectedValue='<%# Bind("TASKMANAGER") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>Andrew Caragher</asp:ListItem>
                            <asp:ListItem>David Roberts</asp:ListItem>
                            <asp:ListItem>Gabriel Clouston</asp:ListItem>
                            <asp:ListItem>Grant Mayhew</asp:ListItem>
                            <asp:ListItem>James Rose</asp:ListItem>
                            <asp:ListItem>Kelvin Wiggins</asp:ListItem>
                            <asp:ListItem>Nicolas Gutierrez</asp:ListItem>
                            <asp:ListItem>Omar Sabbagh</asp:ListItem>
                            <asp:ListItem>Roy Yang</asp:ListItem>
                            <asp:ListItem>Samantha Davies</asp:ListItem>
                            <asp:ListItem>Liang Zhao</asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label6" runat="server" Text='<%# Bind("STATUS") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ASSIGN TO" SortExpression="ASSIGNTO">
                    <EditItemTemplate>
                        <asp:DropDownList ID="ASSIGNTO" runat="server" SelectedValue='<%# Bind("ASSIGNTO") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>Gabriel Clouston</asp:ListItem>
                            <asp:ListItem>Roy Yang</asp:ListItem>
                            <asp:ListItem>Liang Zhao</asp:ListItem>
                            <asp:ListItem>Liang&Roy</asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ASSIGNTO" runat="server" SelectedValue='<%# Bind("ASSIGNTO") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>Gabriel Clouston</asp:ListItem>
                            <asp:ListItem>Roy Yang</asp:ListItem>
                            <asp:ListItem>Liang Zhao</asp:ListItem>
                            <asp:ListItem>Liang&Roy</asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label7" runat="server" Text='<%# Bind("TASKMANAGER") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="EST DURATION" SortExpression="ESTIDURATION">
                    <EditItemTemplate>
                        <asp:DropDownList ID="ESTIDURATION" runat="server" SelectedValue='<%# Bind("ESTIDURATION") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>1 hr</asp:ListItem>
                            <asp:ListItem>2 hrs</asp:ListItem>
                            <asp:ListItem>3 hrs</asp:ListItem>
                            <asp:ListItem>4 hrs</asp:ListItem>
                            <asp:ListItem>5 hrs</asp:ListItem>
                            <asp:ListItem>1 day</asp:ListItem>
                            <asp:ListItem>2 days</asp:ListItem>
                            <asp:ListItem>3 days</asp:ListItem>
                            <asp:ListItem>4 days</asp:ListItem>
                            <asp:ListItem>1 week</asp:ListItem>
                            <asp:ListItem>2 weeks</asp:ListItem>
                            <asp:ListItem>3 weeks</asp:ListItem>
                            <asp:ListItem>4 weeks</asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ESTIDURATION" runat="server" SelectedValue='<%# Bind("ESTIDURATION") %>'   OnDataBound="Sel_Bound">
                            <asp:ListItem Value="">-Select One-</asp:ListItem>
                            <asp:ListItem>None</asp:ListItem>
                            <asp:ListItem>1 hr</asp:ListItem>
                            <asp:ListItem>2 hrs</asp:ListItem>
                            <asp:ListItem>3 hrs</asp:ListItem>
                            <asp:ListItem>4 hrs</asp:ListItem>
                            <asp:ListItem>5 hrs</asp:ListItem>
                            <asp:ListItem>1 day</asp:ListItem>
                            <asp:ListItem>2 days</asp:ListItem>
                            <asp:ListItem>3 days</asp:ListItem>
                            <asp:ListItem>4 days</asp:ListItem>
                            <asp:ListItem>1 week</asp:ListItem>
                            <asp:ListItem>2 weeks</asp:ListItem>
                            <asp:ListItem>3 weeks</asp:ListItem>
                            <asp:ListItem>4 weeks</asp:ListItem>
                        </asp:DropDownList>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label8" runat="server" Text='<%# Bind("ASSIGNTO") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ACT START DATE" SortExpression="STARTDATE">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox10" runat="server" Text='<%# Bind("STARTDATE") %>'  onclick="WdatePicker()"></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox10" runat="server" Text='<%# Bind("STARTDATE") %>'  onclick="WdatePicker()"></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label9" runat="server" Text='<%# Bind("ESTIDURATION") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ACT FINISH DATE" SortExpression="FINISHDATE">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox11" runat="server" Text='<%# Bind("FINISHDATE") %>'  onclick="WdatePicker()"></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox11" runat="server" Text='<%# Bind("FINISHDATE") %>'  onclick="WdatePicker()"></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label10" runat="server" Text='<%# Bind("STARTDATE") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="COMMENT" SortExpression="COMMENT" Visible="false">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox12" runat="server" Text='<%# Bind("COMMENT") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox12" runat="server" Text='<%# Bind("COMMENT") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label11" runat="server" Text='<%# Bind("FINISHDATE") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ACTION" SortExpression="ACTION" Visible="false">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox13" runat="server" Text='<%# Bind("ACTION") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox13" runat="server" Text='<%# Bind("ACTION") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label12" runat="server" Text='<%# Bind("COMMENT") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ShowHeader="False">
                    <EditItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                            CommandName="Update" Text="Update" ForeColor="Red" Font-Size="12"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                            CommandName="Cancel" Text="Cancel" ForeColor="Red" Font-Size="12"></asp:LinkButton>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                            CommandName="Insert" Text="Insert" ForeColor="Red" Font-Size="12"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                            CommandName="Cancel" Text="Cancel" ForeColor="Red" Font-Size="12"></asp:LinkButton>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label13" runat="server" Text='<%# Bind("ACTION") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            
                <asp:TemplateField HeaderText="Internal Notes">

                                    <ItemTemplate>



                                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                            CommandName="Edit" Text="Edit"></asp:LinkButton>
                                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                            CommandName="New" Text="New"></asp:LinkButton>



                                    
                                    </ItemTemplate>

                                    <EditItemTemplate>
                                        <asp:SqlDataSource ID="SqlDataSource8" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:SQLServer2005DBConnectionString %>" 
                        DeleteCommand="DELETE FROM [tblTask_Comment] WHERE [ID] = @ID" 
                        InsertCommand="INSERT INTO [tblTask_Comment] ([CFID], [OPERATOR], [DATE], [COMMENT]) VALUES (@CFID, @OPERATOR, @DATE, @COMMENT)" 
                        SelectCommand="SELECT * FROM [tblTask_Comment] WHERE ([CFID] = @CFID)" 
                        UpdateCommand="UPDATE [tblTask_Comment] SET  [DATE] = @DATE, [COMMENT] = @COMMENT WHERE [ID] = @ID">
                        <DeleteParameters>
                            <asp:Parameter Name="ID" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="CFID" Type="Int32" />
                            <asp:Parameter Name="OPERATOR" Type="String" />
                            <asp:Parameter Name="DATE" Type="DateTime" />
                            <asp:Parameter Name="COMMENT" Type="String" />
                        </InsertParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="TASKID" Name="CFID" PropertyName="Text" 
                                Type="Int32" />
                        </SelectParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="DATE" Type="DateTime" />
                            <asp:Parameter Name="COMMENT" Type="String" />
                            <asp:Parameter Name="ID" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>

                                        <asp:GridView ID="GridView4" runat="server" CssClass="mGrid" 
                        PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" 
                        DataSourceID="SqlDataSource8" AutoGenerateColumns="False" 
                        CommandRowStyle-Font-Size="11"   CommandRowStyle-ForeColor="red"
                        DataKeyNames="ID"  ShowFooter="false" ShowHeader="false"
                        EnableModelValidation="True">
                        <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>


                        <Columns>

                            <asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID" Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="CFID" SortExpression="CFID" Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("CFID") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CFID") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="OPERATOR" SortExpression="OPERATOR">
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("OPERATOR") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="OPERATOR" runat="server" Text='<%# Bind("OPERATOR") %>'  ReadOnly="true"></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="DATE" SortExpression="DATE">
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("DATE") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("DATE") %>' ReadOnly="true"></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="COMMENT" SortExpression="COMMENT">
                                <ItemTemplate>
                                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("COMMENT") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>

                                    <asp:TextBox ID="COMMENT" Rows="5" cols="40" Width="600px" runat="server" TextMode="MultiLine"
                                        Text='<%# Bind("COMMENT") %>'></asp:TextBox>
                                    
                                </EditItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField ShowHeader="False">
                                <EditItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                                        CommandName="Update" Text="Update" Font-Size="14px" ForeColor="Red"></asp:LinkButton>
                                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                        CommandName="Cancel" Text="Cancel" Font-Size="14px" ForeColor="Red"></asp:LinkButton>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                        CommandName="Edit" Text="Edit" Font-Size="14px"  ForeColor="Red"></asp:LinkButton>
                                    &nbsp;

                                </ItemTemplate>

                            </asp:TemplateField>
                            <asp:TemplateField ShowHeader="False">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False"  Font-Size="14px"  ForeColor="Red"
                                        CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are You Sure to Delete?')"></asp:LinkButton>
  
                                </ItemTemplate>
                            </asp:TemplateField>


                        </Columns>
                                            <PagerStyle CssClass="pgr" />
                    </asp:GridView>

                                        <asp:Label ID="CaseLabelnew" runat="server" Text='<%# Eval("TASKID") %>' Visible="false"/>
                                        <asp:Button ID="LinkButtonAddNewComment" runat="server" Text="Add New Comment" onclick="AddNewCommentOnClick" 
                                        CommandArgument='<%# Eval("TASKID") %>' ></asp:Button>
                                    </EditItemTemplate>

                                    <ItemTemplate>



                                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                            CommandName="Edit" Text="Edit"></asp:LinkButton>
                                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                            CommandName="New" Text="New"></asp:LinkButton>



                                    </ItemTemplate>
                                    <InsertItemTemplate>
                                    </InsertItemTemplate>

                                </asp:TemplateField>

                <asp:TemplateField HeaderText="Attachments">
                    <ItemTemplate>


                    </ItemTemplate>
                    <InsertItemTemplate>
                    </InsertItemTemplate>
                    <EditItemTemplate>

                        
                        <asp:Label ID="CFIDLabel" runat="server" Text='<%# Eval("TASKID") %>' visible="false"/>

                        <asp:SqlDataSource ID="SqlDataSource17" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:SQLServer2005DBConnectionString %>" 
                        DeleteCommand="DELETE FROM [tblTask_File] WHERE [ID] = @ID" 
                        InsertCommand="INSERT INTO [tblTask_File] ([DATE], [CASEID], [NAME], [SIZE], [DATA]) VALUES (@DATE, @CASEID, @NAME, @SIZE, @DATA)" 
                        SelectCommand="SELECT * FROM [tblTask_File] WHERE ([CASEID] = @CASEID)" 
                        
                        
                        UpdateCommand="UPDATE [tblTask_File] SET [DATE] = @DATE, [CASEID] = @CASEID, [NAME] = @NAME, [SIZE] = @SIZE, [DATA] = @DATA WHERE [ID] = @ID">
                            <DeleteParameters>
                                <asp:Parameter Name="ID" Type="Int32" />
                            </DeleteParameters>
                            <InsertParameters>
                                <asp:Parameter Name="DATE" Type="DateTime" />
                                <asp:Parameter Name="CASEID" Type="Int32" />
                                <asp:Parameter Name="NAME" Type="String" />
                                <asp:Parameter Name="SIZE" Type="Int64" />
                                <asp:Parameter Name="DATA" Type="Object" />
                            </InsertParameters>
                            <SelectParameters>
                                <asp:ControlParameter ControlID="TASKID" Name="CASEID" PropertyName="Text" 
                                    Type="Int32" />
                            </SelectParameters>
                            <UpdateParameters>
                                <asp:Parameter Name="DATE" Type="DateTime" />
                                <asp:Parameter Name="CASEID" Type="Int32" />
                                <asp:Parameter Name="NAME" Type="String" />
                                <asp:Parameter Name="SIZE" Type="Int64" />
                                <asp:Parameter Name="DATA" Type="Object" />
                                <asp:Parameter Name="ID" Type="Int32" />
                            </UpdateParameters>
                    </asp:SqlDataSource>

                        <asp:GridView ID="GridView5" runat="server" CssClass="mGrid" 
                        PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" 
                        DataSourceID="SqlDataSource17" AutoGenerateColumns="False" 
                        DataKeyNames="ID" ShowFooter="false" ShowHeader="false"
                        EnableModelValidation="True" AllowSorting="True">
                        <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>



                            <Columns>
                                
                                 <asp:TemplateField HeaderText="File Name" SortExpression="NAME">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("NAME") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("NAME") %>'></asp:Label>
                                    </ItemTemplate>

                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID" Visible="false">
                                    <EditItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Upload Date" SortExpression="DATE">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DATE") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("DATE") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="CASEID" SortExpression="CASEID" Visible="false">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("CASEID") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("CASEID") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                               
                                <asp:TemplateField HeaderText="File Size" SortExpression="SIZE">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("SIZE") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label5" runat="server" Text='<%# Bind("SIZE") %>'></asp:Label>
                                    </ItemTemplate>
                                    
                                </asp:TemplateField>

                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:HyperLink ID="HyperLink1" runat="server"
                                            NavigateUrl='<%# Eval("ID", "GetFile.aspx?ID={0}") %>'
                                            Text="Download" Font-Size="14px"></asp:HyperLink>

                                        <asp:LinkButton ID="LinkButtonDelete2" runat="server" CausesValidation="False"  Font-Size="14px"
                                            CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are You Sure to Delete?')"></asp:LinkButton>

                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <PagerStyle CssClass="pgr" />
                        </asp:GridView>




                        <input type="file" name="fileInput" />
                        <asp:Button ID="btnUpload" Text="Upload File Attachment" runat="server"
                                             OnClick="btnUpload_Click" CommandArgument='<%# Eval("TASKID") %>' />




                    </EditItemTemplate>

                </asp:TemplateField>
                



            </Fields>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
        </asp:DetailsView>
        <!-- -->
    </center>
    </div>
    </form>
</body>
</html>
